package ModLayer;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

/**
 * Write a description of class Time here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class TimeAndCheck
{
    private static TimeAndCheck instance;
    
    private TimeAndCheck()
    {
        
    }
    
    public static TimeAndCheck getInstance()
    {
        if(instance == null)
        {
            instance = new TimeAndCheck();
        }
        return instance;
    }
    
    public String getNoForCustomer()
    {
        DateFormat dateFormat = new SimpleDateFormat("ddMMyyyyHHmmss");
        Date date = new Date();
        return dateFormat.format(date);
    }
    
    public String getActualDate()
    {
        DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
        Date date = new Date();
        return dateFormat.format(date);
    }
    
    public String getActualTime()
    {
        DateFormat dateFormat = new SimpleDateFormat("HH-mm-ss");
        Date date = new Date();
        return dateFormat.format(date);
    }
    
    public String checkStringToInt(String data)
    {
        String dataa = data;
        try
        {int dataInt = Integer.parseInt(data.substring(0,data.length()));}
        catch(Exception e)
        {dataa = null;}
        return dataa;
    }
    
    public double checkStringToDouble(String data)
    {
        double dataInt = 0;
        try
        {dataInt = Double.parseDouble(data);}
        catch(Exception e) {}
        return dataInt;
    }
}